import axios from 'axios'
import Dialog from '../component/GLOBAL/Dialog'
axios.defaults.baseURL = 'http://172.16.0.11:8083'
axios.defaults.withCredentials = true //是否带cookie
axios.defaults.headers['Content-Type'] = 'application/json'
axios.interceptors.response.use(response => {
  if (response.data.code !== 200) {
    Dialog.open({
      title: '错误代码' + response.data.code,
      content:"请求失败 未知错误 •﹏•",
      confirmText:'确认',
      alertStatus: true
    });
  }
  return response
}, err => {
  Dialog.open({
    title: '请求异常',
    content:"请求失败 未知错误 •﹏•",
    confirmText:'确认',
    alertStatus: true
  });
  return Promise.reject(err)
})

